﻿#region GNU GPL Version 3 License

/// Copyright 2013 Shailesh Lolam
/// 
/// This file Storage.cs is part of AzEzAuto.
/// 
/// AzEzAuto is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
/// 
/// AzEzAuto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
/// 
/// You should have received a copy of the GNU General Public License along with AzEzAuto. If not, see http://www.gnu.org/licenses/.
/// 
/// History:
/// ______________________________________________________________
/// Created         04-2013             Shailesh Lolam

#endregion
      
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;

namespace AzEzAuto.Entities.Requests
{
    [XmlInclude(typeof(CreateStorage)),
    XmlInclude(typeof(UpdateStorage)),
    XmlInclude(typeof(DeleteStorage))]
    public abstract class StorageBase
    {
        public enum OperationType { Create, Update, Delete, RegenerateKeys };
        public abstract OperationType Operation { get; }
        [XmlElement("SN")]
        public string ServiceName;
    }

    [XmlRoot("CS")]
    public class CreateStorage : StorageBase
    {
        public override OperationType Operation { get { return OperationType.Create; } }
        [XmlElement("DS")]
        public string Description;
        [XmlElement("L")]
        public string Label;
        [XmlElement("AG")]
        public string AffinityGroup;
        [XmlElement("LC")]
        public string Location;
        [XmlElement("GRE")]
        public bool GeoReplicationEnabled;
        [XmlElement("PK")]
        public string PrimaryKey;
        [XmlElement("SK")]
        public string SecondaryKey;
    }

    [XmlRoot("US")]
    public class UpdateStorage : StorageBase
    {
        public override OperationType Operation { get { return OperationType.Update; } }
        [XmlElement("DS")]
        public string Description;
        [XmlElement("L")]
        public string Label;
        [XmlElement("GRE")]
        public bool GeoReplicationEnabled;
    }

    [XmlRoot("DS")]
    public class DeleteStorage : StorageBase
    {
        public override OperationType Operation { get { return OperationType.Delete; } }
    }

    [XmlRoot("RGKY")]
    public class RegenerateKeys : StorageBase
    {
        public override OperationType Operation { get { return OperationType.RegenerateKeys; } }

        [XmlElement("PK")]
        public string PrimaryKey;
        [XmlElement("SK")]
        public string SecondaryKey;
    }

}
